package ljc.nacos.customergoods.goods;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;
/**
 * @author ljchen on 0004, 2022年3月4日
 */
@RestController
@Slf4j
public class CustomerGoodsController {
    @Resource
    private RestTemplate restTemplate;

    @Value("${service-url.nacos-goods-service}")
    private String serverURL;

    @GetMapping(value = "/consumer/nacos/{id}")
    public String consumerDemoApi(@PathVariable("id") Long id ){
        return restTemplate.getForObject(serverURL+"/provider/nacos/"+id,String.class);
    }
}
